package com.shujia.java.day13.demo7;

import java.util.ArrayList;

/**
 * 集合不加泛型
 */
public class ArryListTTest {
    public static void main(String[] args) {
        //不加泛型
        ArrayList list=new ArrayList();
        // 创建学生老师 1.存储数据相同
//        Student student = new Student("张三");
//        Student student1= new Student("张三1");

        //2.数据类型不相同
        Student student = new Student("张三");
        Teacher teacher = new Teacher("李四");
        //遍历
        list.add(student);
        list.add(teacher);

        for (Object o:list) {
            Student s=(Student)o;
            System.out.println(s.getName());
        }
    }
}
